package kis.io.xml.bysocket.apply;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
 * web.xml 配置listener
 * @author bacoo
 *
 */
public class SocketReceiver implements ServletContextListener
{
	private SocketClient client;

	public void contextDestroyed(ServletContextEvent sce)
	{
		if (client != null)
		{
			client.closeSocketServer();
			client.interrupt();
		}
	}

	public void contextInitialized(ServletContextEvent sce)
	{
		if(null==client)
		{
			client = new SocketClient(null);
			client.start();
		}

	}

}
